package com.c.ctgproject.adapter.guang

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.recyclerview.widget.RecyclerView
import com.c.ctgproject.R
import com.c.ctgproject.base.BaseEmptyRecyclerViewAdapterV2
import com.c.ctgproject.entity.guang.*
import com.c.ctgproject.ui.collect.*
import com.c.ctgproject.utils.MyConstants
import com.c.ctgproject.utils.getGson
import com.c.ctgproject.utils.handlerNull
import com.c.ctgproject.utils.noDataHandler
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.textColorResource

class MaterialOutOrderDetailAdapter(private val context: Context, private val mList: List<MaterialOutDetailEntity.DataBean>) : BaseEmptyRecyclerViewAdapterV2(context, mList) {
    override fun createViewHolder(parent: ViewGroup): RecyclerView.ViewHolder {
        val view = LayoutInflater.from(context).inflate(R.layout.item_material_out_order_detail_list, parent, false)
        return MyViewHolder(view)
    }

    override fun handlerData(holder: RecyclerView.ViewHolder, position: Int) {
        if (holder is MyViewHolder) {
            val data = mList[position]
            holder.mNameTV.text = data.materialName.noDataHandler()
            holder.mCodeTV.text = data.materialCode.noDataHandler()
            holder.mCountTV.text = data.outCount.noDataHandler()
            holder.mUnitTV.text = data.unit.handlerNull()
        }
    }


    inner class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
        val mNameTV: TextView = view.findViewById(R.id.mNameTV)
        val mCodeTV: TextView = view.findViewById(R.id.mCodeTV)
        val mCountTV: TextView = view.findViewById(R.id.mCountTV)
        val mUnitTV: TextView = view.findViewById(R.id.mUnitTV)
    }
}